/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.gunncs;

import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;

/**
 *
 * @author anand
 */
public class BumpSensorModel extends SensorModel{

    public static int size = RobotModel.SIZE;
    public static final double PRESSED = 1.0;
    public static final double UNPRESSED = 0.0;
    public static final int ID = 2;

    public BumpSensorModel(){
        state = new double[3];
        state[0] = 0.0;
        state[1] = 0.0;
        state[2] = 0.0;
    }
    
    public void drawAt(Graphics g, int x, int y, double theta) {
        Graphics2D g2d = (Graphics2D) g;
        if(state[0] == PRESSED){
            g2d.setStroke(new BasicStroke(size/6));
            g.setColor(Color.RED);
        }else{
            g.setColor(Color.BLACK);
            g2d.setStroke(new BasicStroke(size/12));
        }
        g.drawArc(x, y, size, size, (int)(theta) + 90, 90);
        if(state[1] == PRESSED){
            g2d.setStroke(new BasicStroke(size/6));
            g.setColor(Color.RED);
        }else{
            g.setColor(Color.BLACK);
            g2d.setStroke(new BasicStroke(size/12));
        }
        g.drawArc(x, y, size, size, (int)(theta) + 0, 90);
        g2d.setStroke(new BasicStroke(2));
    }
}
